#include<stdio.h>
#include<string.h>
#include<assert.h>
int find(int(*arr)[3], int* a, int* b,int d)
{
	assert(arr);
	int r = 0;
	int c = *b-1;
	while (r < *a && c > 0)
	{
		if (arr[r][c] < d)
			r++;
		else if (arr[r][c] > d)
			c--;
		else
		{
			*a = r;
			*b = c;
			return 1;
		}
			
    }
	*a = -1;
	*b = -1;
	return 0;
}
int main()
{
	int arr[3][3] = { 1,2,3,4,5,6,7,8,9 };
	int a = 0;
	int x, y,ret;
	while (scanf("%d", &a)==1)
	{
		y = sizeof(arr[0]) / sizeof(arr[0][0]), x = sizeof(arr) / sizeof(arr[0]);
		ret= find(arr, &x, &y, a);
		printf("x=%d y=%d ret=%d \n", x, y, ret);
	}
	return 0;
}